#include "ManualCalibration.h"
#include <QDate>

ManualCalibration::ManualCalibration(QObject *parent) :
    QObject(parent)
{


}

void ManualCalibration::factoryDefault(ManualCalibViewModel &model)
{
    calibDate = QDate::currentDate().toString("yyyy-MM-dd");

    for(int i = 0; i < model.rowCount(); i++)
    {
      model.setData(model.index(i, 2), "100.00");
      model.setData(model.index(i, 3), calibDate);
    }

    model.database().transaction();  //开始事务处理
    if(model.submitAll()){
        model.database().commit();   //提交
    } else {
        model.database().rollback();  //回滚
    }
}

